<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/WEB-INF/jsp/new/importHead.jsp"%>
<%@ include file="/WEB-INF/jsp/new/importCommonCss.jsp"%>
<style>
div.download {
	margin-bottom: 5px;
}

.download-btn{
	border: 1px solid #e4eaec;
	cursor: pointer;
	background: #f5f5f5;
	text-decoration: none;
	padding: 9px 15px;
	text-align: center;
	color: #76838f;
	text-transform: none;
}
</style>
</head>
<body class="met-navfixed">
	<%@ include file="/WEB-INF/jsp/new/importHeader.jsp"%>

	<!-- body Start -->
	<!--页面主体-->
	<div class="moreList">
		<div class="moreListLeft">
			<img src="${basePath}/image/icon.png" />
			<ul>
				<li class="moreListLeftItem <c:if test="${type eq 'platform'}">active ${type}</c:if>">
		        	<a href="${basePath }/platform">平台动态</a>
		        </li>
		        <li class="moreListLeftItem <c:if test="${type eq 'news'}">active ${type}</c:if>">
		        	<a href="${basePath }/news">信息发布</a>
		        </li>
		        <li class="moreListLeftItem <c:if test="${type eq 'authority'}">active ${type}</c:if>">
		        	<a href="${basePath }/authority">权威解读</a>
		        </li>
		        <li class="moreListLeftItem <c:if test="${type eq 'push'}">active ${type}</c:if>">
		        	<a href="${basePath }/push">项目推送</a>
		        </li>
			</ul>
		</div>
		    <!--内容页-->
		    <div class="moreListContent">
		        <div class="moreListContentTop">
		            <div class="title">
		                <div class="titleText pageIndex currentColumnText">首页</div>
		                <div class="tips">
		                    <span class="backToHome">首页</span>>
		                    <c:if test="${type ne 'index'}">
		                    	<span class="pageIndex currentColumnText"></span>>
		                    </c:if>
		                    <span>正文</span>
		                </div>
		            </div>
		        </div>
		        <div class="moreListContentBottom">
		            <div class="articleHeader">
		                <div class="articleMainTitle">${article.title }</div>
		                <fmt:formatDate value="${article.czsj}" pattern="yyyy-MM-dd HH:mm:ss" var="updateTime" />
		                <div class="articleTime">时间:${updateTime}</div>
		            </div>
		            <div class="articleContent">
		                <div class="articleSubTitle">${article.subTitle}</div>
		                <div class="articleText">
		                    ${article.content}
		                </div>
		                
		                <c:if test="${!empty attachment}">
							<section>
								<div class="download">
									<label class="am-article-lead" style="font-size: 0.2rem;">附件 </label>
									<c:choose>
										<c:when test="${fn:length(attachment.fileName) > 20}">
											<c:set var="fileName"
												value="${fn:substring(attachment.fileName, 0, 20)}..." />
										</c:when>
										<c:otherwise>
											<c:set var="fileName" value="${attachment.fileName}" />
										</c:otherwise>
									</c:choose>
									<span class="am-article-lead" style="text-align: center; font-size: 0.2rem;" title="${attachment.fileName }"> ${fileName } </span>
									<button type="button" class="download-btn"
										onclick="downloadAttachment('${fn:replace(attachment.filePath,'\\','/' )}','${attachment.fileName }')">
										附件下载
									</button>
								</div>
							</section>
						</c:if>
		            </div>
		        </div>
		    </div>
	</div>
	<!-- body End -->

	<%@ include file="/WEB-INF/jsp/new/importFooter.jsp"%>
	<%@ include file="/WEB-INF/jsp/new/importCommonJS.jsp"%>

	<script>
    $(function(){
    	var columnType = '${type}';
    	var $currentColumn = $(".moreListLeftItem." + columnType);
    	$(".currentColumnText").text($currentColumn.text());
    	$(".header").css("background", "url(image/dh_bg.png) 0 0 no-repeat");
    });
    
    function downloadAttachment(fileUrl,fileName){
		var form = document.createElement("form");
		form.action = "${basePath}/downloadAttachments";
		form.method = "post";
		form.target = "_blank";
		form.style.display = "none";
		var input = document.createElement("input");
		var input1 = document.createElement("input");
		input.name = "url";
		input.type = "hidden";
		input.value = fileUrl;
		input1.name = "fileName";
		input1.type = "hidden";
		input1.value = fileName;
		
		form.appendChild(input);
		form.appendChild(input1);
		
		document.body.appendChild(form);
		
		form.submit();
		document.body.removeChild(form);
	}
	</script>
</body>
</html>